package com.example.garbage.controller;

import com.example.garbage.pojo.RespBean;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author Shunrai
 * @create 2024/2/4 16:49
 * @Version 1.0
 * @Description
 */
@RestController
@RequestMapping("/admin/acl")
public class AdminController {
//    eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJSCjAK0A0Ndg1S0lFKrShQsjI0N7AwNTQ0MjbUUSotTi3yTAGKQZh-ibmpQB2JKbmZeUq1AM_QfJpBAAAA.xqhn5UasW81jIeSkIzFqRgxpTHaHvM3OVo3LrsZiUX2VQZ1MgGJBLJ7gyFhEpE4Az_-THrPRlgqhOitklV0UwQ
    @PostMapping("/index/login")
    public RespBean login(@Parameter(description = "用户名", required = true) String username,@Parameter(description = "密码", required = true) String password){
        return RespBean.success("成功","eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAKtWKi5NUrJSCjAK0A0Ndg1S0lFKrShQsjI0N7AwNTQ0MjbUUSotTi3yTAGKQZh-ibmpQB2JKbmZeUq1AM_QfJpBAAAA.xqhn5UasW81jIeSkIzFqRgxpTHaHvM3OVo3LrsZiUX2VQZ1MgGJBLJ7gyFhEpE4Az_-THrPRlgqhOitklV0UwQ");
    }

    @GetMapping("/index/info")
    public RespBean info(){
        Map<Object, Object> objectMap = new HashMap<>();
        objectMap.put("routes",new String[] {
                "aaa",
                "User",
                "Category",
                "Discount",
                "ActivityEdit",
                "CouponRule",
                "Product",
                "Activity",
                "CouponAdd",
                "Trademark",
                "test1",
                "Attr",
                "ActivityAdd",
                "CouponEdit",
                "OrderShow",
                "111",
                "Permission",
                "Spu",
                "UserList",
                "ClientUser",
                "Order",
                "33",
                "t't",
                "Coupon",
                "permision",
                "Acl",
                "ActivityRule",
                "Role",
                "RoleAuth",
                "222",
                "Refund",
                "1223",
                "x",
                "OrderList",
                "Sku"
        });
        objectMap.put("buttons",new String[]{ "cuser.detail",
                "cuser.update",
                "cuser.delete",
                "btn.User.add",
                "btn.User.remove",
                "btn.User.update",
                "btn.User.assgin",
                "btn.Role.assgin",
                "btn.Role.add",
                "btn.Role.update",
                "btn.Role.remove",
                "btn.Permission.add",
                "btn.Permission.update",
                "btn.Permission.remove",
                "btn.Activity.add",
                "btn.Activity.update",
                "btn.Activity.rule",
                "btn.Coupon.add",
                "btn.Coupon.update",
                "btn.Coupon.rule",
                "btn.OrderList.detail",
                "btn.OrderList.Refund",
                "btn.UserList.lock",
                "btn.Category.add",
                "btn.Category.update",
                "btn.Category.remove",
                "btn.Trademark.add",
                "btn.Trademark.update",
                "btn.Trademark.remove",
                "btn.Attr.add",
                "btn.Attr.update",
                "btn.Attr.remove",
                "btn.Spu.add",
                "btn.Spu.addsku",
                "btn.Spu.update",
                "btn.Spu.skus",
                "btn.Spu.delete",
                "btn.Sku.updown",
                "btn.Sku.update",
                "btn.Sku.detail",
                "btn.Sku.remove",
                "btn.all",
                "btn.test.2",
                "aaabbb",
                ""});
        objectMap.put("roles",new String[]{
                "超级管理员"
        });
        objectMap.put("name", "admin");
        objectMap.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return RespBean.success("成功",objectMap);
    }


    @PostMapping("/index/logout")
    public RespBean logout(@Parameter(description = "令牌", required = true) String token){
        return  RespBean.success("成功",null);
    }
}
